package com.huang.springsecurityoauth2.config.security;

import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.filter.OncePerRequestFilter;


import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author HuangShen
 * @Description 授权过滤器
 * @create 2021-01-12 15:29
 */
public class AuthorizationFilter extends OncePerRequestFilter {


    @Override
    protected void doFilterInternal(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, FilterChain filterChain) throws ServletException, IOException {

        // TODO: 2021/1/12  从请求头获取token 解析
        /**
         *
         *  token 有效放入 spring security上下文
         *  SecurityContextHolder.getContext().setAuthentication( new UsernamePasswordAuthenticationToken());
         */


    }
}
